#include "pub_pop_get_date.h"
#include "ui_pub_pop_get_date.h"
#include <QMessageBox>
#include <QtDebug>
#include <QSqlQueryModel>
#include <QModelIndex>
#include "pub_var.h"
#include <QThread>

pub_pop_get_date::pub_pop_get_date(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::pub_pop_get_date)
{
    ui->setupUi(this);

    connect(&tm, &QTimer::timeout, this, &pub_pop_get_date::tmot);

    value_str = "";
}

pub_pop_get_date::~pub_pop_get_date()
{
    delete ui;
}

void pub_pop_get_date::on_buttonBox_accepted()
{

    value_date = ui->cld_date->selectedDate();
    value_str = value_date.toString("yyyy-MM-dd");

}

QString pub_pop_get_date::ret_str()
{
    return value_str;
}

QDate pub_pop_get_date::ret_date()
{
    return value_date;
}

void pub_pop_get_date::on_buttonBox_rejected()
{
    value_str = "";
    //emit retStr( "" );
}

void pub_pop_get_date::tmot()
{
    tm.stop();
}

void pub_pop_get_date::setDisplay(QRect rct, QDate dt)
{

    this->setGeometry(rct);
    ui->cld_date->setSelectedDate(dt);
    //this->setFixedSize(rct.width(),rct.height());

    //tm.start(20);
}
